<%@page import="web.lbsproject.processaudit.model.TaskExecutionFinishStatus4Web"%>
<%@page import="web.lbsproject.processaudit.model.TaskExecution4Web"%>
<%@page import="java.util.LinkedList"%>
<%@page import="lbsproject.processaudit.model.Worker"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>巡检项目人员管理</title>

<link href="css/global.css" type="text/css" rel="stylesheet"/>
</head>
<body>
	<jsp:include page="WEB-INF/template/header.jsp">
		<jsp:param value="current" name="personManage"/>
	</jsp:include>
	<div id="container" class="section">
		<div class="main">
			<p>
				<strong>人员：</strong><%=request.getAttribute("currentWorkerName") %>
				<br/>
				<strong>执行记录统计信息</strong>
				<br/>
				<%
				TaskExecutionFinishStatus4Web totalStatus = 
					(TaskExecutionFinishStatus4Web)request.getAttribute("totalStatus");
				TaskExecutionFinishStatus4Web todayStatus = 
					(TaskExecutionFinishStatus4Web)request.getAttribute("todayStatus");
				%>
				<b>历史</b>
				任务数：<%=totalStatus.getTotalTaskCount() %>&nbsp;
				完成数：<%=totalStatus.getFinishedTaskCount() %>&nbsp;
				其中报修：<%=totalStatus.getNeedRepairCount() %>
				<br/>
				<b>今日</b>
				任务数：<%=todayStatus.getTotalTaskCount() %>&nbsp;
				完成数：<%=todayStatus.getFinishedTaskCount() %>&nbsp;
				其中报修 ：<%=todayStatus.getNeedRepairCount() %>
			</p>
			<!-- 当前员工的执行记录 -->
			<div class="blank"></div>
			
			<p align="center">&nbsp;执行记录&nbsp; </p>
						<div class="blank"></div>
			
			<div >
				<table class="table">
					<thead>
						<tr>
							<th width="14%">时间</th>
							<th width="14%">任务</th>
							<th width="12%">任务状况</th>
							<th width="12%">执行结果</th>
							<th width="20%">执行日志</th>
							<th width="14%">操作</th>
						</tr>
					</thead>
					<tbody>
					<%
					@SuppressWarnings("unchecked")
					List<TaskExecution4Web> exes = (List<TaskExecution4Web>)request.getAttribute("taskExecutions");
					if (exes != null) {
						for (TaskExecution4Web exe: exes) {
					%>
						<tr>
							<td><%=exe.getTime() %></td>
							<td><%=exe.getTaskName() %><br/>(巡检)</td>
							<td><%=exe.getTaskStatus() %></td>
							<td><%=exe.getExeResult() %></td>
							<td>日志信息（暂无）</td>
							<td><a href="CheckTaskRecordDetail?recordID=<%=exe.getRecordID()%>">查看详情</a></td>
						</tr>
					<%
						}
					}
					%>
					</tbody>
				</table>
			</div>
		</div>
		<div class="aside">
			<ul class="side-nav">
				<li class="nav-item"><a id="side-nav-1" class="nav-base" href="personManage.jsp"><b>人员位置</b><em></em></a></li>
				<li class="nav-item high-light"><a id="side-nav-1" class="nav-base" href=""><b>执行记录</b><em>执行记录</em></a>
					<!-- 展示所有员工姓名 -->
					<ul id="task-all">
					<%
					@SuppressWarnings("unchecked")
					List<Worker> allWorkers = (List<Worker>)request.getAttribute("allWorkers");
					if (allWorkers == null) allWorkers = new LinkedList<Worker>();
					for (Worker w: allWorkers) {
					%>
						<!-- 构造查询条件：设定员工号，任务种类为“ALL”，即包含巡检和维修。 -->
						<li><a class="task-base" 
						href="QueryTaskExecution?worker=<%=w.getWorkerID() %>&type=ALL&queryType=recordByPerson">
						<%=w.getName() %></a>
						</li>
					<%
					}
					%>
					</ul>
				</li>
				<li class="nav-item"><a id="side-nav-2" class="nav-base" href="ShowWorkers?mode=add"><b>新增人员</b><em></em></a></li>
				<li class="nav-item"><a id="side-nav-3" class="nav-base" href="ShowAllWorkers"><b>人员信息维护</b><em></em><s></s></a>
				</li>
			</ul> 
		</div>
		<div class="clear"></div>
	</div>
	<jsp:include page="WEB-INF/template/footer.jsp"></jsp:include>
</body>
</html>